﻿using Roton;
using Roton.Audio;
using Roton.Input;
using Roton.Video;
using Roton.ZZT;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Lyon
{
    public partial class Form1 : Form
    {
        Game game;
        IInput input;

        public Form1()
        {
            InitializeComponent();
            FormClosing += ClosingForm;
            input = new InputForm(this);
            game = new Game(GameType.ZZT, null, null, input);
        }

        public void ClosingForm(object sender, FormClosingEventArgs e)
        {
            game.Dispose();
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            //return base.ProcessCmdKey(ref msg, keyData);
            return false;
        }

        private void btnDump_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.FileName = "zztdump.dat";
            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                File.WriteAllBytes(sfd.FileName, game.DumpMemory());
            }
        }
    }
}
